Skip to content

feat(MediaMTX.Cli): allow selecting MediaMTX versions - #1412

Merged
ArgoZhang merged 3 commits into
masterfrom
feat-cli
Dec 4, 2026
Merged

ArgoZhang merged 3 commits into
masterfrom
feat-cli

Conversation

@ArgoZhang

@ArgoZhang ArgoZhang commented Dec 4, 2026 •

Copy link
Copy Markdown
Member

Link issues

fixes #1411

Summary By Copilot

  • Add an optional version argument to --download; accept tags with or without the leading v, validate the version, and retain v1.22.0 as the default.
  • Store and verify each MediaMTX version in its own cache directory; pass the selected version through single-RID and all-RID downloads.
  • Update CLI help, the CLI README, and the bb-mediamtx package skill with version-selection behavior.

Regression?

  • Yes
  • No

This is additive; omitting the version preserves the existing v1.22.0 default.

Risk

  • High
  • Medium
  • Low

The change is limited to parsing and validating the optional version, version-scoped caching, and related documentation. Existing source selection and default behavior remain unchanged.

Verification

  • Manual (required)

  • Automated

  • dotnet build tools\BootstrapBlazor.MediaMtx.Cli --no-restore — passed (0 warnings, 0 errors).

  • No dedicated CLI test project was found; no automated tests were run.

  • Manual verification was not performed.

Packaging changes reviewed?

  • Yes
  • No
  • N/A

☑️ Self Check before Merge

⚠️ Please check all items below before review. ⚠️

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • Merge the latest code from the main branch

Summary by Sourcery

Allow users to choose which MediaMTX release the CLI downloads while preserving the existing default.

New Features:

  • Allow --download to select a MediaMTX release version, accepting tags with or without a leading v and defaulting to v1.22.0.
  • Keep downloaded and verified MediaMTX files in version-specific cache directories.

Documentation:

  • Update CLI help, the CLI README, and the bb-mediamtx package skill with version-selection and cache behavior.

@sourcery-ai

sourcery-ai Bot commented Dec 4, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

API

Extend the CLI download interface to accept and validate an optional MediaMTX version, preserving v1.22.0 as the default.

  • tools/BootstrapBlazor.MediaMtx.Cli/MediaMtxInstaller.cs L45-59, L79-83 (+5 small edits)
  • tools/BootstrapBlazor.MediaMtx.Cli/Program.cs L16-20, L82-89, L136-140 (+3 small edits)

Documentation

Document how to select a version, its default and version-specific cache behavior in the CLI help and README.

  • src/components/BootstrapBlazor.MediaMtx/skills/bb-mediamtx/SKILL.md L17
  • tools/BootstrapBlazor.MediaMtx.Cli/Program.cs L45
  • tools/BootstrapBlazor.MediaMtx.Cli/readme.md L74-80 (+4 small edits)

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@bb-auto bb-auto Bot added the enhancement New feature or request label Dec 4, 2026
@bb-auto bb-auto Bot added this to the v11.0.0 milestone Dec 4, 2026

@bb-auto bb-auto Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Auto approved by bb-auto

@ArgoZhang
ArgoZhang merged commit 5fa1a64 into master Dec 4, 2026
3 checks passed
@ArgoZhang
ArgoZhang deleted the feat-cli branch December 4, 2026 13:55
@sourcery-ai

sourcery-ai Bot commented Dec 4, 2026

Copy link
Copy Markdown

Linked issues

Checked at commit 7de94ce

#1411 feat(MediaMTX.Cli): allow selecting MediaMTX versions · 3 of 3 met

# Requirement Status Notes
1 Add an optional version argument to --download, accepting tags with or without the leading v, while keeping v1.22.0 as the default. ✅ Met The CLI parses and normalizes the optional version; DefaultVersion remains v1.22.0.
2 Keep each version in its own cache directory. ✅ Met The cache path includes the normalized version tag.
3 Document the option in CLI help, the README, and the MediaMTX package skill. ✅ Met All three documentation locations describe version selection.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 3 issues


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

else
{
await MediaMtxInstaller.DeployAsync(source, rid, output, download, copy || defaultAction, force,
await MediaMtxInstaller.DeployAsync(source, version, rid, output, download, copy || defaultAction, force,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Medium · Deployment files come from different versions

When two CLI processes copy different selected versions to the same output directory, or a copy stops after replacing only one file, CopyToolsAsync moves the executable and license separately without an output-level lock or pair-level commit, so the output directory ends up with files from different versions and a later build sees an inconsistent deployment.

Protect both file replacements with a shared output-level lock and commit them as a pair.

Also at tools/BootstrapBlazor.MediaMtx.Cli/MediaMtxInstaller.cs:103.

[GeneratedRegex("^[0-9a-fA-F]{64}$", RegexOptions.CultureInvariant)]
private static partial Regex Sha256Regex();

[GeneratedRegex("^v\\d+\\.\\d+\\.\\d+(-[0-9A-Za-z.-]+)?$", RegexOptions.CultureInvariant)]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Medium · Malformed tags reach release lookup

When the supplied version has an invalid prerelease suffix, such as a trailing hyphen, NormalizeVersion accepts malformed prerelease tags such as v1.22.0- because the optional suffix permits a lone hyphen; DeployAsync then queries the release API and reports a download failure instead of rejecting the version during validation.

Validate prerelease identifiers so the suffix cannot be empty or contain empty dot-separated identifiers.

Comment on lines +82 to +87
if (index + 1 < args.Length && !args[index + 1].StartsWith("--", StringComparison.Ordinal))
{
var versionArgument = args[++index].Trim();
if (versionArgument.Length > 0)
{
version = MediaMtxInstaller.NormalizeVersion(versionArgument);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 High · Version selection cannot be published

When the CLI is packaged or published without overriding its project version, the CLI project still declares package version 11.0.4, and dotnet-tools.json pins that same version, so publishing this change under the current version cannot deliver the new option to users; the repository README also says same-version packages are immutable.

Increment the CLI package version and update the pinned version in dotnet-tools.json.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(MediaMTX.Cli): allow selecting MediaMTX versions

1 participant